//
//  LKChooseBankCardDetailViewController.m
//  YLHelper
//
//  Created by she1323 on 2018/5/4.
//  Copyright © 2018年 she1323. All rights reserved.
//

#import "LKChooseBankCardDetailViewController.h"
#import "LKWorkOrderListDetailCell.h"
#import "LKWorkOrderListDetailPictureCell.h"
#import "LKOrderEditBottomView.h"
#import "LKOrderEditTopView.h"
@interface LKChooseBankCardDetailViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)LKBaseTableview *tableview;
@property(nonatomic,strong)NSArray *titlesArray;
@property(nonatomic,strong)LKOrderEditBottomView *bottomView;
@end

@implementation LKChooseBankCardDetailViewController

-(LKBaseTableview *)tableview{
    if (!_tableview) {
        _bottomView = [[[NSBundle mainBundle] loadNibNamed:@"LKOrderEditBottomView" owner:self options:nil] lastObject];
        [self.view addSubview:_bottomView];
        [_bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(self.view);
            make.height.mas_equalTo(69);
        }];
        _tableview = [LKBaseTableview setTableviewWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT + 10, WIDTH , HEIGHT - NAVIGATION_BAR_HEIGHT - 10 - 70) style:UITableViewStyleGrouped registercellClasss:@[@"LKWorkOrderListDetailCell",@"LKWorkOrderListDetailPictureCell"]];
        [self.view addSubview:_tableview];
        _tableview.delegate = self;
        _tableview.bounces = NO;
        _tableview.dataSource = self;
        _tableview.backgroundColor = [UIColor whiteColor];
        _tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    return _tableview;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableview.estimatedRowHeight = 200;
    // Do any additional setup after loading the view.
}
-(void)setNavgationBackBtn{
    [super setNavgationBackBtn];
    self.navigationItem.title = @"选择银行卡";
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.titlesArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    LKWorkOrderListDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderListDetailCell"];
    cell.arrowBtn.hidden = YES;
    cell.lineView.hidden = YES;
    if (indexPath.row == 0) {
        cell.lineView.hidden = NO;
    }
    if (indexPath.row == self.titlesArray.count - 1) {
        LKWorkOrderListDetailPictureCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderListDetailPictureCell"];
        cell.titleLabel.text = self.titlesArray[indexPath.row];
        return cell;
    }
    cell.titileLabel.text = self.titlesArray[indexPath.row];
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == self.titlesArray.count - 1) {
        return 90;
    }
    return 30;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    LKOrderEditTopView *topView = [[[NSBundle mainBundle] loadNibNamed:@"LKOrderEditTopView" owner:self options:nil] lastObject];
    [topView.leftBtn setTitle:@"划扣账户" forState:UIControlStateNormal];
    [topView.leftBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    [topView.rightBtn setTitle:@"选择" forState:UIControlStateNormal];
    [topView.rightBtn setImage:[UIImage imageNamed:@"productChoose"] forState:UIControlStateNormal];
    return topView;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 43;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    UIView *footerView = [[UIView alloc] init];
    footerView.backgroundColor = cellHeaderBgColor;
    return footerView;
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return section == 1 ? 0.000000000000001:12;
}

-(NSArray *)titlesArray{
    if (!_titlesArray) {
        _titlesArray = @[@"账户卡号：",@"户名：",@"开户行：",@"开户行支行：",@"开户行支行省市：",@"银行卡正面复印件："];
    }
    return _titlesArray;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
